package com.kkb.robotcustomerservice.controller;

import com.github.pagehelper.PageInfo;
import com.kkb.robotcustomerservice.entities.Chat;
import com.kkb.robotcustomerservice.entities.JsonResult;
import com.kkb.robotcustomerservice.service.ChatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author Administrator
 */
@RestController
@RequestMapping("/chat")
@CrossOrigin
public class ChatController {

    @Autowired
    private ChatService chatService;

    @RequestMapping(value = "/getHistoryRecords/{userId}",method = RequestMethod.GET)
    public JsonResult<PageInfo<Chat>> getHistoryRecords(@PathVariable Integer userId,
                                                        @RequestParam(defaultValue = "99999999") int chatId,
                                                        @RequestParam(defaultValue = "1") int pageNum,
                                                        @RequestParam(defaultValue = "5") int pageSize){
        return chatService.jsonResult(userId,chatId,pageNum,pageSize);
    }
}
